package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppSalesFollowupRecord;
import com.ep.modules.app.service.AppSalesFollowupRecordService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/sales_followup_record")
public class AppSalesFollowupRecordController {
    @Autowired
    private AppSalesFollowupRecordService appSalesFollowupRecordService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appSalesFollowupRecordService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppSalesFollowupRecord appsalesfollowuprecord = appSalesFollowupRecordService.getById(id);
        return R.ok().put("appsalesfollowuprecord", appsalesfollowuprecord);
    }

    @SysLog("保存AppSalesFollowupRecord")
    @PostMapping("/save")
    public R save(@RequestBody AppSalesFollowupRecord appsalesfollowuprecord) {
        ValidatorUtils.validateEntity(appsalesfollowuprecord);
        appSalesFollowupRecordService.save(appsalesfollowuprecord);
        return R.ok();
    }

    @SysLog("修改AppSalesFollowupRecord")
    @PostMapping("/update")
    public R update(@RequestBody AppSalesFollowupRecord appsalesfollowuprecord) {
        ValidatorUtils.validateEntity(appsalesfollowuprecord);
        appSalesFollowupRecordService.update(appsalesfollowuprecord);
        return R.ok();
    }

    @SysLog("删除AppSalesFollowupRecord")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appSalesFollowupRecordService.deleteBatch(ids);
        return R.ok();
    }
}